

$(function () {
    console.log(baseUrl);
    $.ajax({
        url: baseUrl + '/slides',
        success: function (result) {
            // console.log('轮播图列表', result);
            const newHtml = template('swipe-id', {swipeList: result, baseUrl: baseUrl})
            $('#slidesBox').html(newHtml)

            var swiper = Swipe(document.querySelector('.swipe'), {
                auto: 2000,
                transitionEnd: function (index) {
                    // index++;
                    $('.cursor span').eq(index).addClass('active').siblings('.active').removeClass('active');
                }
            });
        
            // 上/下一张
            $('.swipe .arrow').on('click', function () {
                var _this = $(this);
        
                if (_this.is('.prev')) {
                    swiper.prev();
                } else if (_this.is('.next')) {
                    swiper.next();
                }
            })
        },
        error: function (err) {
            console.log('err', err);
        }

    })


})